Triggers in DXL, how to attach them?

Hello together,

i am trying to implement a simple trigger which fires if the user modifies a certain attribute in a module,

i have read a lot about triggers, but some how i dont know how the trigger can be attached to run when the module is opened,

what i have done so far is as follows:

in TestTrigger.dxl:

Trigger myTrigger

bool TestTrigger (Trigger myTrigger)
{
    string buttons[] = {"Ok"}
    int answer = messageBox("Do you want save?", buttons, msgInfo)
    
    return true
}

myTrigger= trigger(module -> object -> all -> attribute -> all, modify, 10, TestTrigger)

i added the TestTrigger.dxl in the Addin folder, this resulted that it shows as a menu item,

if open the module and modify an attribute, nothing happens unless i click the menu item first.

of course the goal is not to have a menu item and that the trigger is active directly when a module is opened.

can you please guide me what is the right way to attach/deploy the trigger to the modules?

thanks very much in advance

Regs

Luay


LuayAbu-Shariha - Thu Sep 18 04:25:24 EDT 2014

Re: Triggers in DXL, how to attach them?
llandale - Thu Sep 18 13:47:08 EDT 2014

Your "trigger" command lacks a Name parameter, and the last parameter is a bool function().  This is a "dynamic" trigger which exist only on your client and do not get saved in the module.  This kind of trigger is commonly used to make sure a dialog box gets closed when the module closes. \

You need a "persistent" trigger saved in the module.  Look at some examples.

Re: Triggers in DXL, how to attach them?
LuayAbu-Shariha - Fri Sep 19 01:27:42 EDT 2014

llandale - Thu Sep 18 13:47:08 EDT 2014

Your "trigger" command lacks a Name parameter, and the last parameter is a bool function().  This is a "dynamic" trigger which exist only on your client and do not get saved in the module.  This kind of trigger is commonly used to make sure a dialog box gets closed when the module closes. \

You need a "persistent" trigger saved in the module.  Look at some examples.

Thanks a lot for the reply and the hints, i will give it a try

Regards

Luay